<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>标题</title>
<script src="js\jqery-3.5.1.min.js"></script>
<script src=""></script>
<meta name="keywords" content="">
<meta name="description" content="">
<style>
 *{margin:0; padding:0; list-style:none;}
 #box{
  width: 100px;
  height: 100px;
  background: #ccc;
  /* padding: 50px; */
  display: block;
 }
</style>
<link rel="stylesheet" href="./css/publicgoods.css">
<link rel="stylesheet" href="./css/picture.css">
</head>
<body>
    <input id="newname" type="text" placeholder="给商品起个名吧">
 <div id="pict">
     <div  style="height: 30px;margin: 24px auto;text-align: center;">照片拖在下面_(:з」 ∠)_</div>
    <div class="content" id="pic">
    </div>
 </div>

<div class="newstyle-pic">
    <input type="text" class="text__" placeholder="添加样式">
    <input type="button" value="√" class="right">
 <div id="newstyle-pic">

 </div>
<input type="text" name="" id="" class="text__" placeholder="添加配置/套餐">
<input type="button" value="√" class="right">
<div id="newstyle">

 </div>
</div>

<div id="submit">提交</div>


<script>
var n=0;
var imgs=new Array();
var box=document.getElementById('pic');
var pic=document.getElementById('pic');
box.ondragover=function (e){
 e.preventDefault();
}
box.ondrop=function (e){
 e.preventDefault();
 // console.log(e.dataTransfer.files[0]);
 var f=e.dataTransfer.files[0];//获取到第一个上传的文件对象
 var fr=new FileReader();//实例FileReader对象
 fr.readAsDataURL(f);//把上传的文件对象转换成url
 fr.onload=function (e){
//   console.log(e);
  // var Url=e.target.result;//上传文件的URL
  var Url=this.result;//上传文件的URL
  imgs[n++]=Url;
  pic.innerHTML+='<img src="'+Url+'" alt="" id="picture-'+(n-1)+'">';
//   document.getElementsByClassName('content').style.background="rgb(255, 255, 255)";
  
console.log(Url);  

 }
}
function submit(){
    $.ajax({
                url: "http://192.168.137.175??????",
                ret: "0",
                type:"POST",
                dataType: "json",
                data: JSON.stringify({
                    token: token,
                    img:imgs,
                }),
                success: function(data){
                    console.log(data)
                    // if (data.ret != "0"){
                    //     window.location.href="http://192.168.137.175/login.html"
                    // }  
                    // else{
                    //     window.location.href="http://192.168.137.175/shoppingcar.html"
                    // }
                }
            })
}

</script>
</body>
</html>
